#ifndef PFS_CONNECTION_H
#define PFS_CONNECTION_H
#include <event.h>
#include <vector>
#include <cstring>
#include "Job.h"
#include "config.h"
#include "Thread.h"
#include "Tcp.h"
using namespace std;
namespace PFS
{
    class EventConnection 
    {
        public:
            EventConnection();
            EventConnection(Tcp *tcp, short event_flags);
            virtual ~EventConnection(){}
            void set_fd(int fd);
            int get_fd();
            void set_tcp(const Tcp *tcp);
            Tcp* get_tcp();
            void set_event_flag(short flag);
            struct event* get_event();
            enum conn_state get_conn_state()
            {
                return m_state;
            }
            void set_conn_state(enum conn_state state)
            {
                m_state = state;
            }
            void set_thread(EventThread* thread)
            { this->thread = thread; }
            EventThread* get_thread()
            { return thread; }
        private:
            Tcp* m_tcp;
            EventThread *thread;
            struct event ev;
            short event_flags;
            enum conn_state m_state;
    };
}
#endif
